﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebLibSolPedBE;

namespace WebApplication1
{
    public partial class formSolicitudCajaChicaDet : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["objSolCC"] != null)
                {
                    SolCajaChicaBE obj = (SolCajaChicaBE)Session["objSolCC"];
                    CargarLista(obj.BELNR, obj.LIFNR, obj.BUKRS, obj.GJAHR);
                }
            }
        }

        private void CargarLista(string ip_nrorep, string ip_caja, string ip_bukrs, string ip_gjahr)
        {
            List<SolCajaChicaDetBE> lst = LibSolPedDALF.DaoFactory.SolCajaChicaF.getLstSolCajaChicaDet(ip_nrorep, ip_caja, ip_bukrs, ip_gjahr);
            gvGrid.DataSource = lst;
            gvGrid.DataBind();
        }

        protected void gvGrid_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //Find the control
                var lblDocliqBudat = (Label)e.Row.FindControl("lblDocliqBudat");
                var lblBlartDlifnr = (Label)e.Row.FindControl("lblBlartDlifnr");
                var lblDkostlDgasto = (Label)e.Row.FindControl("lblDkostlDgasto");
                var lblWrbtrWaers = (Label)e.Row.FindControl("lblWrbtrWaers");
                //Display the data
                var data = e.Row.DataItem;
                SolCajaChicaDetBE it = (SolCajaChicaDetBE)data;
                lblDocliqBudat.Text = it.DOCLIQ + " " + it.BUDAT;
                lblBlartDlifnr.Text = it.BLART + " - " + it.DLIFNR;
                lblDkostlDgasto.Text = it.KOSTL + " - " + it.DGASTO;
                lblWrbtrWaers.Text = it.WRBTR + " " + it.WAERS;
            }
        }
    }
}